#include "event.h"

namespace sleek
{
    namespace core
    {
        namespace device
        {
            event::event() : asRunning(true)
            {
            }
            event::~event()
            {
            }
            void event::force(input a)
            {
            }
            bool event::manage(input *a)
            {
                current = a;
                if(a->exit_msg) exit();
                //a->clear();
                return false;
            }
            void event::reset()
            {
                current->clear();
            }
            void event::exit()
            {
                kill();
            }
            void event::kill()
            {
                asRunning = false;
            }
            /** ********************************************** **/
            input::input() { clear(); }
            void input::operator = (input n)
            {
                type = n.type;
                for(core::u16 i = 0; i<MOUSE_CODE_COUNT; ++i)
                    mouse[i] = n.mouse[i];
                for(core::u16 i = 0; i<KEY_KEY_CODES_COUNT; ++i)
                    key[i] = n.key[i];

                gui.called = n.gui.called;
                gui.type = n.gui.type;
                gui.code = n.gui.code;

                exit_msg = n.exit_msg;
                mouse_pos = n.mouse_pos;
            }
            void input::clear()
            {
                type = EVENT_NOTHINK;
                for(core::u16 i = 0; i<MOUSE_CODE_COUNT; ++i)
                    mouse[i] = false;
                for(core::u16 i = 0; i<KEY_KEY_CODES_COUNT; ++i)
                    key[i] = false;

                gui.called = 0;
                gui.type = gui::IGT_NOTHINK;
                gui.code = gui::IET_NOTHINK;

                exit_msg = false;
            }
        }
    }
}
